/*
 *  hihocoder.com
 *
 *  Category: Greed
 */

/*-------- Includes --------*/
#include <iostream>
#include <algorithm>

using namespace std;

/*-------- Defines --------*/


/*-------- Types --------*/


/*-------- Global Variables --------*/
int N;
int L[100002];

/*-------- Function Prototypes --------*/


/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    cin >> N;

    long sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> L[i];
        sum += L[i];
    }

    sort(L, L + N);

    int p = 0, v = 0, sv = 0;
    while (p < N) {
        v = L[p] - sv;

        sv  += v;
        sum -= v * (N - p);

        while (p < N && L[p] == sv) p++;

        cout << sum << endl;
    }

    return 0;
}

/*-------- Functions --------*/

